<!-- 实际呈现效果的组件 -->
<template>
  <div class="com-container">
    <div class="com-chart" ref="trender_ref">seller display</div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      myChart: null,
      allData: null,
      currentPage: 2,
      totalPage: 0,
      pageSize: 5,
      timerId: null,
    };
  },

  mounted() {
    this.initChart();
    this.getData();
    window.addEventListener("resize", this.screenAdapter);
    this.screenAdapter();
  },
  destroyed() {
    window.removeEventListener("resize", this.screenAdapter);
  },

  methods: {
    //初始化echarts实例对象,要在dom结果加载完成后调用
    initChart() {
      this.myChart = this.$echarts.init(this.$refs.trender_ref, "chalk");
      const initOption = {};
      this.myChart.setOption(initOption);
    },
    // 获取数据
    async getData() {
      // await this.$http.get()
      // 对allData进行赋值
      this.updateChart();
    },

    // 更新图表
    updateChart() {
      const dataOption = {};
      this.myChart.setOption(Option);
    },

    screenAdapter() {
      // console.log(this.$refs.seller_ref.offsetWidth);
      const titleFontSize = (this.$refs.seller_ref.offsetWidth / 100) * 3.6;
      const adapterOption = {};

      this.myChart.setOption(adapterOption);

      // 收到调用resize才能产生效果
      this.myChart.resize();
    },
  },
};
</script>
<style lang=""></style>
